using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using NHibernate.Expression;

namespace WOODIFramework.Model
{
    [ActiveRecord("PageItem"), JoinedBase]
    public class PageItem : ActiveRecordBase<PageItem>
    {
        private Guid id;
        private String name;
        private int _rowPosition;
        private int _columnPosition;
        private IList _pages;

        [Property]
        public int ColumnPosition
        {
            get { return _columnPosition; }
            set { _columnPosition = value; }
        }

        [Property]
        public int RowPosition
        {
            get { return _rowPosition; }
            set { _rowPosition = value; }
        }

        [PrimaryKey(PrimaryKeyType.Guid)]
        public Guid Id
        {
            get { return id; }
            set { id = value; }
        }

        [Property("Name", NotNull = false)]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        [HasAndBelongsToMany(typeof(Page),
        Table = "PageItemPage", ColumnKey = "PageItemId", ColumnRef = "PageId", Inverse=true)]
        public IList Pages
        {
            get { return _pages; }
            set { _pages = value; }
        }
    }
}
